package com.mc.test.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;

import com.mc.test.dao.UserDAO;
import com.mc.test.domain.User;
import com.mc.test.service.UserService;

@Service
public class UserServiceImpl implements UserService {

	@Autowired
	private UserDAO userDAO;

	@Transactional
	public List<User> getAll() {
		return userDAO.findAll();
	}

	@Transactional
	public String testDummy() {
		// TODO Auto-generated method stub
		System.out.println("Test Dummy UserServiceImpl");
		List<User> list = userDAO.findAll();
		String s = StringUtils.collectionToCommaDelimitedString(list);
		System.out.println("List of String " + s);
		return s;

	}

	public void setUserDAO(UserDAO userDAO) {
		this.userDAO = userDAO;
	}

}
